package entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Klasa Comment povezuje entitet COMMENT u bazi podataka i sinhronizuje
 * 
 * @author rigo
 * 
 */
@Entity
@Table(name="COMMENT")
public class Comment implements Serializable {
	private static final long serialVersionUID = -2551164428372068042L;
	@Id
	@GeneratedValue(strategy=IDENTITY) 
	@Column(name="CO_ID", unique=true, nullable=false)
	protected Integer commentId;

	@ManyToOne	
	@JoinColumn(name="AP_ID", referencedColumnName="AP_ID", nullable=false)
	protected Appointment appointment;
	
	@ManyToOne	
	@JoinColumn(name="US_ID_CHANGE", referencedColumnName="US_ID", nullable=true)
	protected User userChanged;
	
	@ManyToOne	
	@JoinColumn(name="US_ID", referencedColumnName="US_ID", nullable=false)
	protected User user;

	@Column(name="CO_DATE", unique=false, nullable=false)
	protected Date date;
	

	@Column(name="CO_TEXT", unique=false, nullable=false)
	protected String text;

	@Column(name="CO_DATECAHNGED", unique=false, nullable=true)
	protected Date dateChanged;
	
	@Column(name="CO_DELETED", unique=false, nullable=false)
	protected Boolean deleted;
	
	public Integer getCommentId() {
		return commentId;
	}

	public User getUser() {
		return user;
	}

	public Date getDate() {
		return date;
	}

	public String getText() {
		return text;
	}

	public Date getDateChanged() {
		return dateChanged;
	}

	public User getUserChanged() {
		return userChanged;
	}

	public void setCommentId(Integer commentId) {
		this.commentId = commentId;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public void setText(String text) {
		this.text = text;
	}

	public void setDateChanged(Date dateChanged) {
		this.dateChanged = dateChanged;
	}

	public void setUserChanged(User userChanged) {
		this.userChanged = userChanged;
	}

	public Appointment getAppointment() {
		return appointment;
	}

	public void setAppointment(Appointment appointment) {
		this.appointment = appointment;
	}

	public Boolean getDeleted() {
		return deleted;
	}

	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}

}
